// 第三个 string 表示必须有返回值，而且返回值是 string 类型
// c? 表示c参数可选可不选，但一旦选了就得是 number 类型
function test1(a:string,b:string,c?:number):string{
    console.log(a.substring(0,1) + b.substring(0,1))
    return a.substring(0,1) + b.substring(0,1)
}
let myname:string = test1('aaa','bbb')
console.log(myname)

//--------------------------------------------

// 定义一个函数返回接口的形式
interface IFunc{
    (a:string,b:string,c?:number):string
}
let myfunc2:IFunc = function test1(a:string,b:string,c?:number):string{
    console.log(a.substring(0,1) + b.substring(0,1))
    return a.substring(0,1) + b.substring(0,1)
}

interface IObj{
    name:string,
    age:number,
    getName:(name:string)=>string
}
let obj:IObj = {
    name:'hhl',
    age:18,
    getName:(name:string)=> {
        return name
    }
}
let name:string = obj.getName('aaa')

export default {}